package com.lonty.intelligence.mapper;

import com.lonty.intelligence.model.Building;
import com.lonty.intelligence.request.BuildingByAreaIdList;
import com.lonty.intelligence.request.BuildingInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

/**
 * @Author 陈璇
 * @Date 2020/4/17 13:17
 * @Version 1.0
 */
@Mapper
public interface BuildingMapper {

    /**
     * 保存楼栋
     * @param building
     * @return
     */
    int saveBuilding(Building building);

    /**
     * 分页获取楼栋
     * @param areaId
     * @return
     */
    int countBuilding(String areaId);

    List<Building> listBuilding(@Param("areaId") String areaId, @Param("page") Integer page, @Param("size") Integer size);

    /**
     * 根据小区ID获取楼栋并且分组
     * @param areaId
     * @return
     */
    List<BuildingByAreaIdList> getBuildingByAreaId(String areaId);

    /**
     * 根据小区ID、道路、楼栋号获取楼栋
     * @param building
     * @return
     */
    List<Building> buildingIsExit(Building building);

    /**
     * 修改楼栋
     * @param id
     * @param type
     * @return
     */
    int modifyBuilding(@Param("id") String id,@Param("type") Integer type);

    /**
     * 根据所有信息获取楼栋
     * @param building
     * @return
     */
    Building getByAllInfo(Building building);

    /**
     * 获取楼栋及业主信息
     * @return
     */
    BuildingInfo getBuildingInfo(String buildingId);

    /**
     * 根据道路获取小区ID
     * @param road
     * @return
     */
    String getAreaByRole(String road);

    /**
     * 根据道路、楼栋号、门牌号获取楼栋
     * @param road
     * @param buildingNumber
     * @param houseNumber
     * @return
     */
    Building getBuilding(@Param("road") String road,
                         @Param("buildingNumber") String buildingNumber,
                         @Param("houseNumber") String houseNumber);

}
